<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://cdn.jsdelivr.net/npm/vue@3.2.38/dist/vue.global.min.js"></script>
</head>

<body>
  <div id="app">
    <div ref="content">
      <h1>haha</h1>
    </div>
    <hr>
    <button @click.once="addLine">点我增加一行</button>
    <button @click="addButton">点我增加一个按钮</button>
  </div>
  <script>
    Vue.createApp({
      data() {
        return {

        }
      },
      methods: {
        addLine() {
          const node = document.createElement('h1')
          node.innerHTML = "haha，我是新增的一行"
          this.$refs.content.appendChild(node)
        },
        addButton() {
          const node = document.createElement('button')
          node.innerHTML = "haha，我是新增的按钮"
          this.$refs.content.appendChild(node)
        }
      }
    }).mount('#app')
  </script>
</body>

</html>